package com.zhumo.sz.controller;


import com.zhumo.sz.common.CommonInsert;
import com.zhumo.sz.common.Result;
import com.zhumo.sz.entity.area.BaseArea;
import com.zhumo.sz.service.PublicService;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/sz/service/public")
public class PublicController {

    @Autowired
    private PublicService publicService;


    @RequestMapping("/area")
    public Result<String> addAreaInfo(){
        CommonInsert<BaseArea> commonInsert = publicService.addBaseArea();
        if (commonInsert.getResult() == commonInsert.getNum()){
            String message = "插入" + commonInsert.getNum() + "地域信息";
            log.info(message);
            return Result.ok(message);
        }else {
            return Result.fail("插入异常");
        }
    }
}
